<%@ page contentType="text/html; charset=utf-8" language="java"  errorPage="" %>
<%@ page import="com.netscenery.yang.model.LeafList" %>
<%@ page import="com.netscenery.yang.model.Env" %>
<%@ page import="operate.OperateType"%>
<%@page import="offer.GetDataSource"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
LeafList leafList = new LeafList(new Env(),"MyLeafList");
//获取结点对象
Object itemNode = request.getAttribute("itemNode");
Object opType   = request.getAttribute("opType"); //获取操作对象
if( null != itemNode){
	leafList = (LeafList)itemNode;
}
if( null == opType){
	String notices = "opType 参数错误";
%>
   <%=notices %>
<%
    return;
}
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>LeafList</title>
    <meta http-equiv="Pragma" content="no-cache" />
    <meta http-equiv="Cache-Control" content="no-cache" />
    <meta http-equiv="Expires" content="0" />
	<link rel="stylesheet" type="text/css" href="<%=basePath%>/css/items.css" />
</head>
<script type="text/javascript">
   <% if( (null != itemNode) 
        &&  (!opType.toString().equalsIgnoreCase(OperateType.LOAD))){ %>

	   		 alert("数据保存成功！");
	   		 
  <%   		 if(opType.toString().equalsIgnoreCase(OperateType.ADD)){ %>
	   		 	 //新增节点时，重新加载数
	   		 	 parent.reloadTree();
  <%   		 }
   }%>
</script>
<body class="body">
 <form method="post" action="<%=basePath %>ChoiceOpreateServlet" class="IndexFormStyle" >
   <input type="hidden"  id="nodeId" name="nodeId" value="<%=request.getAttribute("nodeId") %>"  />
   <div id="TableContent" class="tableContent" >
   <table border="0" class="mainTable" >
     <tr>
       <td colspan="2"  class="titleTd">
       The LeafList [<%=leafList.getName() %>] information 
       </td>
     </tr>
     <tr>
       <td>&nbsp;LeafList name:</td>
       <td>
          <input class="inputText" id="_name" name="_name" value="<%=leafList.getName()==null?"":leafList.getName()%>"  readonly="readonly" />
       </td>
     </tr>
     <tr>
       <td colspan="2" >
         <% if(!leafList.isConfig()){ %>
          &nbsp;<input type="checkbox" id="isConfig" name = "isConfig"  value="true" />Config
         <%} else{%> 
          &nbsp;<input type="checkbox" id="isConfig" name = "isConfig" checked="checked" value="true" />Config
         <%}%> 
       </td>
     </tr>
     <tr>
       <td>&nbsp;Min-elements:</td>
       <td>
          <input class="inputText" id="minElements" name="minElements" value="<%=leafList.getMinElements()==0?"":leafList.getMinElements()%>"  />
       </td>
     </tr>
     <tr>
       <td>&nbsp;Max-elements:</td>
       <td>
          <input class="inputText" id="maxElements" name="maxElements" value="<%=leafList.getMaxElements()==0?"":leafList.getMaxElements()%>"  />
       </td>
     </tr>
     <tr>
       <td>&nbsp;Status:</td>
       <td>
          <select style="width:305px;   height:23px;"   class="inputSelect" id="_status" name="_status">
          <% for(int i = 0 ; i < GetDataSource.getStatusList().length ; i++ ){ %>
          <%     if(leafList.getStatus().getStatus().equalsIgnoreCase(GetDataSource.getStatusList()[i])){ %>  
                    <option  value="<%= GetDataSource.getStatusList()[i]%>" selected="selected"><%=GetDataSource.getStatusList()[i] %></option>
          <%     }else{ %> 
                    <option  value="<%= GetDataSource.getStatusList()[i]%>" ><%=GetDataSource.getStatusList()[i] %></option>   
          <%     }
             } %>
          </select>
       </td>
     </tr>
     <tr>
       <td>&nbsp;Type:</td>
       <td>
          <input class="inputText" id="_type" name="_type" value="<%=leafList.getMaxElements()==0?"":leafList.getMaxElements()%>"  />
       </td>
     </tr>
     <tr>
       <td>&nbsp;Units:</td>
       <td>
          <input class="inputText" id="_units" name="_units" value="<%=leafList.getUnits()==null?"":leafList.getUnits()%>"  />
       </td>
     </tr>
     <tr>
       <td colspan="2">&nbsp;Description:</td>
     </tr>
     <tr>
       <td colspan="2">
         <textarea class="textArea"  id="description" name="description"><%=leafList.getDescription()==null?"":leafList.getDescription() %></textarea>
       </td> 
     </tr>
     <tr>
       <td colspan="2">&nbsp;Reference:</td>
     </tr>
     <tr>
       <td colspan="2">
         <textarea class="textArea"  id="reference" name="reference"><%=leafList.getReference()==null?"":leafList.getReference() %></textarea>
       </td>
     </tr>
   </table>
   </div>
   <div id="submitContent" class="submitContent">
     <input type="submit" value="Apply"  />
   </div>
   </form>
</body>
</html>